'''
Created on 2011-11-13

@author: latios
'''



from PyQt4.QtGui import *
import sys
import csv
from mainwindow_ui import Ui_MainWindow
class MainWindow (QMainWindow, Ui_MainWindow):
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)
        self.setupUi(self)
    def actionFileOpen_triggered(self):
        filename = QFileDialog.getOpenFileName(self, "open csv file")
        if (filename == ''): return
        self.readCSV(filename)
    def readCSV(self, filename):
    	reader = csv.reader(open(filename))
        firstLine = True
        for row in reader:
            if (firstLine):
                self.tableWidget.setHorizontalHeaderItem(row)
                firstLine=False
            else :
                self
            
        	
        
app = QApplication(sys.argv)
mainwindow = MainWindow();
mainwindow.show()
#mainwindow.exe()
app.exec_()
